clear-turtles

 

Clear-patches is a command that clears the patches by resetting all patch variables to their default initial values, including setting their color to black. It is usually located in a command procedure. The shorthand version of this command is cp.

Clear-turtles is a command that removes all the turtles as well as resets the numbering of turtles. It is usually located in a command procedure. The shorthand version of this command is ct. See die for more about removing turtles from a plot.

These are only used when we do not want to use clear-all. For example, if we wanna clear the patches but keep some global variables’ values & the position of the turtles, you would use clear-patches. If we wanna clear the turtles but keep the patches and their initial values, you would use clear-turtles.

 

Try it Yourself

 
 
 
 
 
 
 

What's next?

Once you mastered the clear-turtles primitive, don't stop there. Check out the resources below to improve your NetLogo skills.

 
Similar primitives:
die

Remove a turtle or link from the world.

Read more
clear-all

clears all the drawings, turtles, plots, etc., leaving a blank slate.

Read more
turtles-own

Declare a variable that belongs to turtles.

Read more
ask

a reporter that is used to make the agents in the agentset do something.

Read more
 
Learn another primitive